home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 60.zip / BS1 part 60 / Highspeed pascal.adf / HSPascal / AmigaDemos / SimpleSpeech.pas < prev    next >
Pascal/Delphi Source File  |  1992-01-16  |  3KB  |  116 lines

  1. {--------------------------------------------------------------------------
  2.  
  3.                      HighSpeed Pascal for the Amiga
  4.  
  5.                            SIMPLE SPEECH DEMO
  6.  
  7.                   Programmed by Martin Eskildsen 1991
  8.  
  9.                   Copyright (c) 1991 by D-House I ApS
  10.                          All rights reserved
  11.  
  12.  
  13.   Version : Date (dd.mm.yy) : Comment
  14.   -----------------------------------
  15.     1.00 : 06.11.91 : First version
  16.  
  17. --------------------------------------------------------------------------}
  18. program SimpleSpeech;
  19.  
  20. uses Init, Narrator, Speech;
  21.  
  22. const
  23.   Hello = 'Hello World!';
  24.   N     = 6;
  25.  
  26. procedure Pause;
  27. begin
  28.   Delay(1000)
  29. end;
  30.  
  31. procedure SayIt(s : string);
  32. begin
  33.   Inform(s);
  34.   Say(s)
  35. end;
  36.  
  37. procedure SayItAndWait(s : string);
  38. begin
  39.   SayIt(s);
  40.   Pause
  41. end;
  42.  
  43. procedure Rates;
  44. var i : 1..N;
  45. begin
  46.   for i := 1 to N do begin
  47.     SetRate( (Narrator.MAXRATE - Narrator.MINRATE) div N * i);
  48.     Say(Hello)
  49.   end;
  50.   Pause
  51. end;
  52.  
  53. procedure Frequency;
  54. var i : 1..N;
  55. begin
  56.   for i := 1 to N do begin
  57.     SetFrequency( (Narrator.MAXFREQ - Narrator.MINFREQ) div N * i);
  58.     Say(Hello)
  59.   end;
  60.   Pause
  61. end;
  62.  
  63. procedure Pitch;
  64. var i : 1..N;
  65. begin
  66.   for i := 1 to N do begin
  67.     SetPitch( (Narrator.MAXPITCH - Narrator.MINPITCH) div N * i);
  68.     Say(Hello)
  69.   end;
  70.   Pause
  71. end;
  72.  
  73. begin
  74.   if PrepareEnvironment('Simple Speech') then begin
  75.  
  76.     Message('Let''s initiate the Translator lib and Narrator device');
  77.     if Panic(not OpenSpeech, 'Could not initiate speech properly') then begin
  78.       CloseDown;
  79.       Exit
  80.     end;
  81.  
  82.     SetVolume( (Narrator.MAXVOL - Narrator.MINVOL) div 2 );
  83.  
  84.     SayItAndWait('Hello, I''m an Amiga demo!');
  85.  
  86.     SayIt       ('We are now using the default values.');
  87.     SayItAndWait('Why don''t we change them?');
  88.  
  89.     SetSex(male);    SayIt       ('This is a male voice');
  90.     SetSex(female);  SayItAndWait('And this is a female voice');
  91.     DefaultParameters([SexParam]);
  92.  
  93.     SayItAndWait('Let''s play with the word rate. The words are "' + Hello + '"');
  94.     Rates;
  95.     DefaultParameters([RateParam]);
  96.  
  97.     SayItAndWait('And the frequency.');
  98.     Frequency;
  99.     DefaultParameters([FreqParam]);
  100.  
  101.     SayItAndWait('And the pitch.');
  102.     Pitch;
  103.     DefaultParameters([PitchParam]);
  104.  
  105.     SetVolume(Narrator.MINVOL + 10);    SayIt       ('This is a whisper');
  106.     SetVolume(Narrator.MAXVOL);         SayItAndWait('AND THIS IS LOUD!');
  107.  
  108.     SetVolume( (Narrator.MAXVOL - Narrator.MINVOL) div 2 );
  109.  
  110.     SayIt('That was all I had to say!');
  111.  
  112.     CloseSpeech;
  113.     CloseDown
  114.   end
  115. end.
  116.